<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
	String contextPath = request.getContextPath();
%> 
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>후기</title>
<style type="text/css">
	#board_wrap{
		margin-left: 77px;
		margin-top: 90px;
		padding: 0;
		font-family: Verdana;
		font-size: 12px;
		color: #696969;
		line-height: normal;
		font-style: normal;
		margin-bottom: 100px;
	}
	#board_center{
		width: 699px;
		margin-right: 10px;
	}
	#board_title{
		float: left;
		width: 699px;
		text-align: left;
		position: relative;
		margin-left: -20px;
	}
	#content_table th{
		font-weight: bold;
		background:#fff2e2; 
		text-align:center; 
		padding:10px 0 10px 0; 
		border-top:1px solid #e0e0e0;
		width: 120px;
		height: 25px;
	}
	#content_table{
		float: left;
		margin-top: 20px;
	}
	#content_table td{
		height:20px;
		font-size: 11px;
		text-align: center;
		border-bottom:1px solid #d3ccbe; 
		padding:10px 0; 
	}
	#content_table a{
		text-decoration: none;
		color: #696969;
		cursor: pointer;
	}
	#content_table a:hover{
		color:red; 
		font-weight: bold;
	}
	.search{
		margin: 0 auto;
	}
	.inputb{
		border-bottom: #999999 1px solid;
		border-left: #cecece 1px solid;
		border-right: #999999 1px solid;
		border-top: #cecece 1px solid;
		color: #000000;
		font-size: 9pt;
		background-color: #ededed;
		width:50px;
		height:25px;
	}
	.align-right{
		text-align: right;
	}
	
</style>
<script type="text/javascript">
function goLogin(){
	alert('하겐나 회원전용입니다. 로그인하세요~!');
	location.href='login.do';
}
</script>
</head>
<body>
<div id="board_wrap">
	<div id="board_center">
		<div id="board_title">
				<img src="./images/board/title_review_4.png">
		</div>
		<div>
			<form action="boardList.do" name="search" method="get">
				<table class="search">
					<tr>
						<td>
							<select name="keyField">
								<option value="all">전체</option>
								<option value="branch_name">매장명</option>
								<option value="board_title">제목</option>
								<option value="board_content">내용</option>
							</select>
						</td>
						<td>
							<input type="text" size="16" name="keyWord">
						</td>
						<td>
							<input type="submit" value="찾기" class="inputb">
						</td>
					</tr>
				</table>
			</form>
		</div>
		<div id="main_contents">
			<table id="content_table">
				<tbody>
					<tr>
						<th>NO</th>
						<th>매장명</th>
						<th style="width:230px;">TITLE</th>
						<th>작 성 자</th>
						<th>DATE</th>
					</tr>
					<c:forEach var="article" items="${boardList}">
					<tr>
						<td>
							${number}
							<c:set var="number" value="${number-1}"/>
						</td>
						<td>
							${article.branch_name}
						</td>
						<td>
						<c:if test="${empty email}">
							<c:if test="${article.filename != null}">
							<a onclick="goLogin();">${article.board_title}</a>&nbsp;&nbsp;<img src="./images/board/image.png" width="5%">
							</c:if>
							
							<c:if test="${article.filename == null}">
							<a onclick="goLogin();">${article.board_title}</a>
							</c:if>
						</c:if>
						<c:if test="${!empty email && email != 'admin'}">
							<input type="hidden" name="board_num" value="${boardCommand.board_num}">
							
							<c:if test="${article.filename != null}">
							<a href="<%=contextPath %>/view.do?board_num=${article.board_num}">${article.board_title}</a>&nbsp;&nbsp;<img src="./images/board/image.png" width="5%">
							</c:if>
							
							<c:if test="${article.filename == null}">
							<a href="<%=contextPath %>/view.do?board_num=${article.board_num}">${article.board_title}</a>
							</c:if>
							
						</c:if>
						
						<c:if test="${email == 'admin'}">
							<input type="hidden" name="board_num" value="${boardCommand.board_num}">
							
							<c:if test="${article.filename != null}">
							<a href="<%=contextPath %>/view.do?board_num=${article.board_num}">${article.board_title}</a>&nbsp;&nbsp;<img src="./images/board/image.png" width="5%">
							</c:if>
							
							<c:if test="${article.filename == null}">
							<a href="<%=contextPath %>/view.do?board_num=${article.board_num}">${article.board_title}</a>
							</c:if>
						</c:if>
						
						</td>
						<td>${article.writer}</td>
						<td>${article.regdate}</td>
					</tr>
					</c:forEach>
					<c:if test="${count == 0}">
					<tr>
						<td colspan="5" class="align-center">등록된 게시물이 없습니다.</td>
					</tr>	
					</c:if>
				</tbody>
			</table>
		</div>
		<div>
		<form action="writeForm.do" method="POST">
		<input type="hidden" name="email" value="${email}">
			<table style="width: 699px;">
				<c:if test="${count > 0}">
				<tr>
					<td style="text-align: center;">${pagingHtml}</td>
				</tr>
				</c:if>
				<c:if test="${!empty email}">
					<tr>
						<td style="text-align: right;">
							<input type="submit" value="글쓰기" class="inputb">
						</td>
					</tr>
				</c:if>
			</table>
		</form>
		</div>
	</div>
</div>

</body>
</html>